
    var oneDay = 24 * 3600 * 1000;
    var minute=60*1000;
    var value = Math.random() * 1000;
    var now=new Date('2018-04-01 00:00:00');
    function randomData() {
        now = new Date(+now + minute);
        value = value + Math.random() * 21 - 10;
        return [
              {name:now,value:[now,Math.round(value)]},
              {name:now,value:[now,Math.round(value + Math.random() * 40)]}
            
        ];
      }

/**
 * 获取流量监测折线图配置项
 */
function getStreamMonitorLineOption() {


    var colors = ['#5793f3', '#d14a61', '#675bba'];



    var webData = [];
    var firewallData = [];
    var now = +new Date();
    for (var i = 0; i < 30; i++) {
      var data = randomData();
      webData.push(data[0]);
      firewallData.push(data[1]);
    }

    let option = {
      color: colors,

      tooltip: {
        trigger: 'axis',
        axisPointer: {
          type: 'cross'
        }
      },
      grid: {
          top:'40',
          bottom:'80',
        left:'60',
        right: '100'
      },

      legend: {
        data: ['防火墙流量', 'Web流量']
      },
      dataZoom: [{
          show: true,
          xAxisIndex: 0,
          start: 0,
          end: 100
        },
        {
          type: 'inside',
          xAxisIndex: 0,
          start: 0,
          end: 100
        },
        {
            show: true,
            yAxisIndex: 0,
            start: 70,
            end: 100
          },
          {
            type: 'inside',
            yAxisIndex: 0,
            start: 70,
            end: 100
          }
      ],
      xAxis: [{
        type: 'time',
        axisTick: {
          alignWithLabel: true
        }
      }],
      yAxis: [{
          type: 'value',
          name: '防火墙流量',

          position: 'left',
          axisLine: {
            lineStyle: {
              color: colors[0]
            }
          },
          axisLabel: {
            formatter: '{value} 次'
          }
        },
        {
          type: 'value',
          name: 'Web流量',

          position: 'right',
          axisLine: {
            lineStyle: {
              color: colors[1]
            }
          },
          axisLabel: {
            formatter: '{value} MB'
          }
        }
      ],
      series: [{
          name: 'Web流量',
          type: 'line',
          smooth: true,          
          data: webData
          
        },
        {
          name: '防火墙流量',
          type: 'line',
          yAxisIndex: 1,
          smooth: true,          
          data: firewallData
        }
      ]
    };
    console.log(webData,firewallData);
    return option;
  }

/**
 * 获取响应码柱状图配置项
 */
  function getResponseCodeBarOption() {
    let option = {
      backgroundColor: '',
      tooltip: {
        trigger: 'axis',
        axisPointer: { // 坐标轴指示器，坐标轴触发有效
          type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
        }

      },
      grid: {
        left: '5%',
        right: '15%',
        bottom: '28',
        top: '38',
        containLabel: true
      },
      xAxis: [{
        name: '类型',
        nameTextStyle: {
          fontSize: 12,
        },
        data: ['200', '302', '304', '500'],
        type: 'category',
        axisLine: {
          lineStyle: {
            color: 'black',
            width: 1, //这里是为了突出显示加上的
          }
        },
        axisTick: {
          alignWithLabel: true
        },

      }],
      yAxis: [{
        name: '数量',
        nameTextStyle: {
          fontSize: 12
        },
        type: 'value',
        axisLine: {
          lineStyle: {
            color: 'black',
            width: 1, //这里是为了突出显示加上的
          }
        },
        axisTick: {
          alignWithLabel: true
        },
        axisLabel: {
          formatter: '{value}'
        }
      }],
      series: [{
        barWidth: '40%',
        type: 'bar',
        data: [{
          value: 2081,
          itemStyle: {
            normal: {
              color: '#003366'
            }
          }
        }, {
          value: 229,
          itemStyle: {
            normal: {
              color: '#006699'
            }
          }
        }, {
          value: 415,
          itemStyle: {
            normal: {
              color: '#4cabce'
            }
          }
        }, {
          value: 338,
          itemStyle: {
            normal: {
              color: '#dd545d'
            }
          }
        }],
        itemStyle: {
          normal: {
            //color: '#a08596'
            color: 'rgba(64,64,64,0.45)'
          }
        }
      }]
    };
    return option;
  }

/**
 * 获取协议类型饼图配置项
 */
  function getProtocolTypePieOption() {
    let option = {
      backgroundColor: '',
      color: ['#003366', '#006699', '#4cabce', '#dd545d'],
      tooltip: {
        trigger: 'item',
        formatter: "{b} <br/>出现次数: {c} 次(占比{d}%)"
      },
      series: [{
        type: 'pie',
        position: 'center',
        center: ['50%', '50%'],
        radius: ['30%', '70%'],
        //roseType : 'radius',
        label: {
          color: 'black',
          //formatter:"{b}-{c}次\n(占比{d}%)"
          formatter: "{b}"

        },
        itemStyle: {
          //color:"#a08596",
          //color:'rgba(64,64,64,0.4)',
          borderWidth: 1,
          borderColor: '#fff'
        },
        labelLine: {
          lineStyle: {
            color: '#a08596'
          },
          length: 10,
          length2: 20
        },
        data: [{
            name: 'HTTP',
            value: 1465,
          },
          {
            name: 'TCP',
            value: 1013,
          },
          {
            name: 'UDP',
            value: 653,
          },
          {
            name: 'ICMP',
            value: 231,
          }


        ]
      }]
    };
    return option;
  }